package com.pcitc.app.model;

import com.pcitc.app.model.BaseObject;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="TBL_ORG",schema="ADMIN")
public class TblOrg extends BaseObject implements Serializable {
    private Long orgid;
    private String orgname;
    private Long porgid;
    private Long orglevel;
    private String orgaddress;
    private String zipcode;
    private String linkman;
    private String email;
    private String weburl;
    private String memo;
    private Long pxid;
    private Set<TblUser> tblUsers = new HashSet<TblUser>(0);

    @Id  @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getOrgid() {
        return this.orgid;
    }
    
    public void setOrgid(Long orgid) {
        this.orgid = orgid;
    }
    
    @Column(name="ORGNAME", length=256)
    public String getOrgname() {
        return this.orgname;
    }
    
    public void setOrgname(String orgname) {
        this.orgname = orgname;
    }
    
    @Column(name="PORGID", precision=22, scale=0)
    public Long getPorgid() {
        return this.porgid;
    }
    
    public void setPorgid(Long porgid) {
        this.porgid = porgid;
    }
    
    @Column(name="ORGLEVEL", precision=22, scale=0)
    public Long getOrglevel() {
        return this.orglevel;
    }
    
    public void setOrglevel(Long orglevel) {
        this.orglevel = orglevel;
    }
    
    @Column(name="ORGADDRESS", length=256)
    public String getOrgaddress() {
        return this.orgaddress;
    }
    
    public void setOrgaddress(String orgaddress) {
        this.orgaddress = orgaddress;
    }
    
    @Column(name="ZIPCODE", length=256)
    public String getZipcode() {
        return this.zipcode;
    }
    
    public void setZipcode(String zipcode) {
        this.zipcode = zipcode;
    }
    
    @Column(name="LINKMAN", length=256)
    public String getLinkman() {
        return this.linkman;
    }
    
    public void setLinkman(String linkman) {
        this.linkman = linkman;
    }
    
    @Column(name="EMAIL", length=256)
    public String getEmail() {
        return this.email;
    }
    
    public void setEmail(String email) {
        this.email = email;
    }
    
    @Column(name="WEBURL", length=256)
    public String getWeburl() {
        return this.weburl;
    }
    
    public void setWeburl(String weburl) {
        this.weburl = weburl;
    }
    
    @Column(name="MEMO", length=256)
    public String getMemo() {
        return this.memo;
    }
    
    public void setMemo(String memo) {
        this.memo = memo;
    }
    
    @Column(name="PXID", precision=22, scale=0)
    public Long getPxid() {
        return this.pxid;
    }
    
    public void setPxid(Long pxid) {
        this.pxid = pxid;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="tblOrg")
    public Set<TblUser> getTblUsers() {
        return this.tblUsers;
    }
    
    public void setTblUsers(Set<TblUser> tblUsers) {
        this.tblUsers = tblUsers;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TblOrg pojo = (TblOrg) o;

        if (orgname != null ? !orgname.equals(pojo.orgname) : pojo.orgname != null) return false;
        if (porgid != null ? !porgid.equals(pojo.porgid) : pojo.porgid != null) return false;
        if (orglevel != null ? !orglevel.equals(pojo.orglevel) : pojo.orglevel != null) return false;
        if (orgaddress != null ? !orgaddress.equals(pojo.orgaddress) : pojo.orgaddress != null) return false;
        if (zipcode != null ? !zipcode.equals(pojo.zipcode) : pojo.zipcode != null) return false;
        if (linkman != null ? !linkman.equals(pojo.linkman) : pojo.linkman != null) return false;
        if (email != null ? !email.equals(pojo.email) : pojo.email != null) return false;
        if (weburl != null ? !weburl.equals(pojo.weburl) : pojo.weburl != null) return false;
        if (memo != null ? !memo.equals(pojo.memo) : pojo.memo != null) return false;
        if (pxid != null ? !pxid.equals(pojo.pxid) : pojo.pxid != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (orgname != null ? orgname.hashCode() : 0);
        result = 31 * result + (porgid != null ? porgid.hashCode() : 0);
        result = 31 * result + (orglevel != null ? orglevel.hashCode() : 0);
        result = 31 * result + (orgaddress != null ? orgaddress.hashCode() : 0);
        result = 31 * result + (zipcode != null ? zipcode.hashCode() : 0);
        result = 31 * result + (linkman != null ? linkman.hashCode() : 0);
        result = 31 * result + (email != null ? email.hashCode() : 0);
        result = 31 * result + (weburl != null ? weburl.hashCode() : 0);
        result = 31 * result + (memo != null ? memo.hashCode() : 0);
        result = 31 * result + (pxid != null ? pxid.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("orgid").append("='").append(getOrgid()).append("', ");
        sb.append("orgname").append("='").append(getOrgname()).append("', ");
        sb.append("porgid").append("='").append(getPorgid()).append("', ");
        sb.append("orglevel").append("='").append(getOrglevel()).append("', ");
        sb.append("orgaddress").append("='").append(getOrgaddress()).append("', ");
        sb.append("zipcode").append("='").append(getZipcode()).append("', ");
        sb.append("linkman").append("='").append(getLinkman()).append("', ");
        sb.append("email").append("='").append(getEmail()).append("', ");
        sb.append("weburl").append("='").append(getWeburl()).append("', ");
        sb.append("memo").append("='").append(getMemo()).append("', ");
        sb.append("pxid").append("='").append(getPxid()).append("', ");
        
        sb.append("]");
      
        return sb.toString();
    }

}
